freecivfandomcom-20200223-history
Localization
Here you can find information about the localization (l10n) of Freeciv. Freeciv uses the gettext system for internationalization and localization support. See the info file about gettext for further information. For a quick overview of gettext, see Freeciv's gettext guide and gettext notes. See Freeciv Internationalization for the technical details of Freeciv translation. How to Contribute If a locale is already supported, contact the Primary Contact (see list above) for any information specific to that locale. You may also find information of general interest to all contributors here, including how to submit changes. See the info file about gettext for definitive information on its use. How to add support for new languages Suppose you want to add support for Polish (the pl locale), then you would have to do the following things: # Download and install the Freeciv source. Check here for the latest CVS snapshots. # Modify the configure.in and configure.ac line containig ALL_LINGUAS to include 'pl': change: ALL_LINGUAS="es fr" to: ALL_LINGUAS="es fr pl" # Regenerate the AutoConf stuff: $ autoheader; autoconf # Configure Freeciv: $ ./configure # Change to the po directory: $ cd ./po # Create the freeciv.pot file: $ make freeciv.pot # Copy freeciv.pot to pl.pox (the auxiliary .po file): $ cp freeciv.pot pl.pox # Edit the pl.pox file and translate all entries. # Rename pl.pox to pl.po: $ mv pl.pox pl.po # Make the pl.gmo file: $ make pl.gmo How to update your translations As the code continues to change, new strings may be added and old strings may be changed or removed. Suppose you now want to update the Polish translation you made by following the above steps. You have to do the following things: # Download and install the Freeciv source. Check here for the latest CVS snapshots. (This should now include your previous pl.po file.) # Configure Freeciv: $ ./configure # Change to the po directory: $ cd ./po # Create the auxiliary .po file: $ make pl.pox (This will contain a merge of your previous translations and changes in the source code.) # Edit the pl.pox file and update all entries. # Rename pl.pox to pl.po: $ mv pl.pox pl.po # Make the pl.gmo file: $ make pl.gmo How to create the most current freeciv.pot file To create the most current freeciv.pot file, you would have to do the following things: # Check-out the latest Freeciv source from the CVS repository. See here for information on using CVS. # Configure Freeciv: $ ./configure # Change to the po directory: $ cd ./po # Create the freeciv.pot file: $ make freeciv.pot How to handle qualified translatable strings Some strings are too ambiguous to be easily translated. The canonical example is the English word "game", which is used in Freeciv in two roles: 1. The game we play: Freeciv; the name of the first menu item. 2. The terrain special of game animals -- animals hunted for food. These are two very different concepts, and must frequently be translated into different words. However, they often occur in the code as the sole content of a string. If they were internationalized in the normal manner, they would be combined into a single entry in the freeciv.pot file: #: menu.c:123 terrain.c:321 msgid "Game" msgstr "" And, hence, could not be translated into the two distinct words it needs be. Freeciv solves this problem by introducing the concept of qualified translatable strings. Strings are "qualified" by prefixing them with a descriptive tag, surrounded by "?" and ":". Using our game example, the qualified strings might be: "?play:Game" "?animals:Game" And these would show up as two distinct entries in the freeciv.pot file: #: menu.c:123 msgid "?play:Game" msgstr "" #: terrain.c:321 msgid "?animals:Game" msgstr "" These could now be translated as needed. E.g., in de.po: #: menu.c:123 msgid "?play:Game" msgstr "?Spiel:Spiel" #: terrain.c:321 msgid "?animals:Game" msgstr "?Tiere:Wild" Which would appear to the user as: Spiel and Wild Note that you don't have to translate the descriptive tags. E.g.: #: menu.c:123 msgid "?play:Game" msgstr "?play:Spiel" #: terrain.c:321 msgid "?animals:Game" msgstr "?animals:Wild" How to check your translations for common errors Before submitting your translations for inclusion in the CVS, you should check to make sure they don't contain obvious errors. * First, near the top of your .po file you should have an entry that looks something like: msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2000-04-07 13:50-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: ENCODING\n" (perhaps with some of the fields filled in). This entry must exist, and must contain at least: msgid "" msgstr "" "POT-Creation-Date: 2000-04-07 13:50-0400\n" * Second, you should use the check_po.pl script to validate your .po file. You can find this script in the CVS in the ./po directory. To use it, simply give it the name of your .po file, e.g.: % cd po % ./check_po.pl de.po If any errors exist in the specified .po file, a description of each problem will be printed. Localization Mini-FAQ These address a few problems and questions about Localization. How does Freeciv determine what language it should use? Freeciv checks the environment variable $LANG for that, so you should set it; for example, to use German, issue the bash command "export LANG=de_DE" before you start civserver or civclient, or "setenv LANG de_DE" if you use tcsh. If you still get English, perhaps you are trying an invalid value (the value "de" instead of "de_DE" will probably fail to work) or the Freeciv software was compiled without localization support. When I try to "make freeciv.pot", no file is generated. It's likely that ./configure didn't find the GNU version of xgettext. Look at the output from ./configure, and if you find something like: checking for xgettext... : (note, just a ":", not a path to xgettext) then ./configure could not find any version of xgettext. Or, if you see something like: checking for xgettext... /usr/bin/xgettext found xgettext program is not GNU xgettext; ignore it then ./configure could not find the GNU version of xgettext. In either case, you will need to get and install the GNU version of the gettext system. If they are installed in a non-standard directory, you have to add it to your PATH before calling ./configure. Should I try to translate "Freeciv"? No, just leave it "Freeciv" wherever you find it. (Also, note that the "c" in "Freeciv" is not capitalized.) The Emacs po-mode doesn't start when I load a po-file. What should I do? Make sure you have GNU Gettext installed. You can download it from a GNU ftp mirror site. I have GNU Gettext installed but the po-mode still doesn't start. What should I do now? Type 'info gettext' in a shell (or use the Emacs info-mode), select 'Basics' and select 'Installation'. Then you will find more information about installing the Emacs po-mode. Emacs throws the error message "Fontifying XX.po...buffer too big" when I load a po-file. Is the po-file to big? Don't worry. The buffer/file size is just fine. What Emacs is trying to say is that the value of the variable font-lock-maximum-size is too small. Emacs refuses to fontify buffers larger than this value because font-lock may consume a lot of resources for big buffers. To change the value, press 'M-x', type 'customize-variable', press RET, type 'font-lock-maximum-size' and press RET. Read the helptext in the buffer that opens and customize by changing the value to something like 524288 (2^19) (or whatever value you think is suitable). Now the files should become fontified when you open them (unless they are larger than 512kB).